import { getMediaList, search } from '@/api/media'

export default {

  state: {
    providersKeys: [
      {
        value: 'pornhub',
        label: 'PornHub'
      }],
    orderTypes: [
      {
        value: 'nc',
        label: '无所谓'
      },
      {
        value: 'mr',
        label: '最近的'
      },
      {
        value: 'mv',
        label: '最多观看'
      }
    ]
  },
  actions: {
    getSearchData: ({ commit }, option) => {
      return new Promise((resolve, reject) => {
        search(option).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    getMediaList: ({ commit }, option) => {
      return new Promise((resolve, reject) => {
        getMediaList(option).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}
